package com.zjl.litemall.db.service;

import com.zjl.litemall.db.dao.LitemallNoticeAdminMapper;
import com.zjl.litemall.db.domain.LitemallNoticeAdminExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author cat
 * @description
 * @date 2022/2/25 下午9:53
 */

@Service
public class LitemallNoticeAdminService {
    @Resource
    private LitemallNoticeAdminMapper noticeAdminMapper;

    public int countUnread(Integer adminId) {
        LitemallNoticeAdminExample example = new LitemallNoticeAdminExample();
        // andReadTimeIsNull()是干什么的？？？
        // addCriterion("read_time is null");  不理解
        example.or().andAdminIdEqualTo(adminId).andReadTimeIsNull().andDeletedEqualTo(false);
        return (int)noticeAdminMapper.countByExample(example);
    }
}
